<?php
include("conn/conn.php");
if(!$_SESSION['username']){
    echo "<script>window.location.href='orderlogin.php';</script>";
	exit;
  }

$orderid = $_GET['orderid'];


$sql1=mysql_query("select * from tb_dingdan where id='".$orderid."'",$conn);

$order = mysql_fetch_array($sql1);

$array=explode("@",$order[spc]);
$arrayquatity=explode("@",$order[slc]);


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<link rel="stylesheet" type="text/css" href="kfc_files/style.css">
<link rel="stylesheet" type="text/css" href="kfc_files/jquery-ui.css">
<!-- 加载JS -->
<script type="text/javascript" src="kfc_files/jquery-1.js"></script>
<script type="text/javascript" src="kfc_files/jquery_002.js"></script>
<script type="text/javascript" src="kfc_files/jquery.js"></script>


<script type="text/javascript" src="kfc_files/jquery_003.js"></script>

<script type="text/javascript" src="kfc_files/base.js"></script>


<script type="text/javascript" src="kfc_files/property_cn.js"></script>



<!-- 加载CSS样式 -->
<!-- 加载外部JS -->
<script type="text/javascript" src="kfc_files/check.js"></script>

</head>
<body>
<form id="mainForm" action="">
<input id="tag" value="check" type="hidden">
<input id="oid" value="" type="hidden">
<!--////////////top////////-->
<div id="top_nav">
 <div class="staticLogo"></div>
 <div class="top_menu">
   <div class="top_menu_1">
        <div class="fl_r">
      
     <div class="clear"></div>
   </div>
   <div class="clear"></div>
 </div>
</div>
<!--//////////login_content start//////////-->
<div id="content">
  <div class="login_content">
    <div class="login_content_top"></div>
    <div class="login_content_main"> 
      <!--查询订单 开始-->
      <div class="query_order"> 
        <!--订单主要信息-->
        
        <!--订单详情展开-->
        <div class="query_order_details" style="display:block;">
          <!-- 1、个人信息-->
          <div class="personal_info">
            <p><span class="personal_info_title">个人信息</span></p>
            <p><span class="personal_info_span_1">顾客姓名：</span><span class="personal_info_span_2"><?php echo $order['shouhuoren']; ?></span></p>
            <p><span class="personal_info_span_1">订单号：</span><span class="personal_info_span_2"><?php echo $order['dingdanhao']; ?></span></p>
            <p><span class="personal_info_span_1">联系电话：</span><span class="personal_info_span_2"><?php echo $order['tel']; ?></span></p>
            <p><span class="personal_info_span_1">送餐地址：</span><span class="personal_info_span_2"><?php echo $order['dizhi']; ?></span></p>
          	<p><span class="personal_info_span_1">支付方式：</span><span class="personal_info_span_2">货到现金付款</span></p>
         
          
          </div>
          <!--个人信息结束-->
          <div class="hr_1"></div>
          <!--2、订单信息-->
          <div class="order_info">
            <p><span class="personal_info_title">订单详情</span></p>
            <table class="query_order_table_1" border="1" width="100%">
              <tbody><tr>
                <th width="8%">序号</th>
                <th width="20%">品名</th>
                <th width="10%">单价</th>
                <th width="8%">数量</th>
                <th width="10%">小计</th>
              </tr>


				<?php
				$total=0;
				$index2=0;
					for($i=0;$i<count($array)-1;$i++){
						$id=$array[$i];
						$num=$arrayquatity[$i];
						if($id!=""){
							$index2++;
							$sql=mysql_query("select * from tb_shangpin where id='".$id."'",$conn);
							$info=mysql_fetch_array($sql);
							$total1=number_format($num*$info[shichangjia],1);
							$total+=$total1;
				?>

					  <tr>
						<td align="left"><?php echo $index2; ?></td>
						<td> <?php echo $info[mingcheng]; ?></td>
						<td><span class="ft_color_red"><?php echo $info[shichangjia]; ?>元</span></td>
						<td><?php echo $num; ?></td>

						<td><span class="ft_color_red"><span class="ft_color_red"><?php echo $total1; ?></span>元</span></td>
					  </tr>


				<?php }}?>	


              </tbody></table>
            <div class="total_price_div">
              <p><span class="total_price_span_query">
                    <em class="ft_b">
                         总金额：</em>
                         <?php echo number_format($total,1); ?>元</span>
	          	</p>
            </div>
          </div>
          <!-- 订单信息结束--> 
          <div class="hr_1"></div>
          <div class="print_order_wel">祝您用餐愉快，并欢迎您再次惠顾！</div>
          <div class="print_order_tip">
			<div class="print_tip_title">友情提示：</div>
			<div class="print_tip_content">
				<ul class="order_tips">
					<li class="order_tip_item">您可在“查询订单”中查询本次订餐的所有信息和送餐进程</li>
					<li class="order_tip_item">您的订单会实时下到我们的门店，员工会立即开始制作食品，因此我们无法接受修改或取消订单服务。</li>
				</ul>
			</div>
		</div>
        </div>
        <!--订单详情展开结束--> 
      </div>
      <!--查询订单 结束--> 
      
    </div>
    <div class="login_content_btm"></div>
  </div>
  
	<!-- alert 弹出层 -->
	<div id="dialog-message-alert" title="友情提示" closebtn="false" style="display: none;">
		<span></span>
	</div>

</div>
<!--//////////login_content end//////////--> 
</form>
<script type="text/javascript">
$(function() {
	// 打印
	window.print();
});

</script>

</body></html>